
//
//  UIBarButton+Extension.swift
//  RyueWeibo
//
//  Created by jugg on 2016/11/30.
//  Copyright © 2016年 Renyue'husband. All rights reserved.
//

import UIKit


extension UIBarButtonItem{
    
    convenience init(title: String, imageName: String?=nil,target:Any?,action: Selector) {
        self.init()
    
        let button = UIButton()
    
    
        button.addTarget(target, action: action, for: .touchUpInside)
    button.setTitle(title, for: .normal)
    
    if imageName != nil {
        button.setImage(UIImage(named:imageName!), for: .normal)
    }
        
        button.setTitleColor(UIColor.darkGray, for: .normal)
        button.setTitleColor(UIColor.orange, for: .highlighted)
        
        button.titleLabel?.font=UIFont.systemFont(ofSize: 14)
        button.sizeToFit()

        self.customView=button
    }
    
    
    
    
    
}
